<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/src/loader.js#L21" class="view-source btn btn-action"><i class="icon-zoom-in"> </i> View source</a><a href="http://github.com/angular/angular.js/edit/master/src/loader.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">angular.module</code>
<div><span class="hint">API in module <code ng:non-bindable="">ng</code>
</span>
</div>
</h1>
<div><h2 id="Description">Description</h2>
<div class="description"><div class="angular-module-page"><p>The <code>angular.module</code> is a global place for creating, registering and retrieving Angular modules.
All modules (angular core or 3rd party) that should be available to an application must be
registered using this mechanism.</p>
<p>When passed two or more arguments, a new module is created.  If passed only one argument, an
existing module (the name passed as the first argument to <code>module</code>) is retrieved.</p>
<h3>Module</h3>
<p>A module is a collection of services, directives, filters, and configuration information.
<code>angular.module</code> is used to configure the <a href="api/AUTO.$injector"><code>$injector</code></a>.</p>
<pre class="prettyprint linenums">
// Create a new module
var myModule = angular.module('myModule', []);

// register a new service
myModule.value('appName', 'MyCoolApp');

// configure existing services inside initialization blocks.
myModule.config(function($locationProvider) {
  // Configure existing providers
  $locationProvider.hashPrefix('!');
});
</pre>
<p>Then you can create an injector and load your modules like this:</p>
<pre class="prettyprint linenums">
var injector = angular.injector(['ng', 'MyModule'])
</pre>
<p>However it&#39;s more likely that you&#39;ll just use
<a href="api/ng.directive:ngApp"><code>ngApp</code></a> or
<a href="api/angular.bootstrap"><code>angular.bootstrap</code></a> to simplify this process for you.</p>
</div></div>
<h2 id="Usage">Usage</h2>
<div class="usage"><pre class="prettyprint linenums">angular.module(name[, requires], configFn);</pre>
<h4 id="parameters">Parameters</h4><table class="variables-matrix table table-bordered table-striped"><thead><tr><th>Param</th><th>Type</th><th>Details</th></tr></thead><tbody><tr><td>name</td><td><a href="" class="label type-hint type-hint-object">!string</a></td><td><div class="angular-module-page"><p>The name of the module to create or retrieve.</p>
</div></td></tr><tr><td>requires <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-array">Array.&lt;string&gt;</a></td><td><div class="angular-module-page"><p>If specified then new module is being created. If unspecified then the
the module is being retrieved for further configuration.</p>
</div></td></tr><tr><td>configFn</td><td><a href="" class="label type-hint type-hint-function">Function</a></td><td><div class="angular-module-page"><p>Optional configuration function for the module. Same as
<a href="api/angular.Module#config"><code>Module#config()</code></a>.</p>
</div></td></tr></tbody></table><h4 id="returns">Returns</h4><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-module">module</a></td><td><div class="angular-module-page"><p>new module with the <a href="api/angular.Module"><code>angular.Module</code></a> api.</p>
</div></td></tr></table></div>
</div>
